package ar.edu.unlam.lyc.comunes;

import java.util.Hashtable;

public class PalabrasReservadas {
	private static PalabrasReservadas instance = null;
	private Hashtable<String, String> lista = null;
	private Hashtable<String, String> lista2 = null;
	public static final String RSV_STR = "string";
	public static final String RSV_INT = "int";
	public static final String RSV_REAL = "real";

	private PalabrasReservadas() {
		this.lista = new Hashtable<String, String>();
		this.lista2 = new Hashtable<String, String>();

		this.lista.put("RSV_NOT", "not");
		this.lista2.put("not", "RSV_NOT");

		this.lista.put("RSV_AND", "and");
		this.lista2.put("and", "RSV_AND");

		this.lista.put("RSV_OR", "or");
		this.lista2.put("or", "RSV_OR");

		this.lista.put("RSV_STR", "string");
		this.lista2.put("string", "RSV_STR");

		this.lista.put("RSV_INT", "int");
		this.lista2.put("int", "RSV_INT");

		this.lista.put("RSV_REAL", "real");
		this.lista2.put("real", "RSV_REAL");

		this.lista.put("RSV_DEC", "dec");
		this.lista2.put("dec", "RSV_DEC");

		this.lista.put("RSV_ENDEC", "endec");
		this.lista2.put("endec", "RSV_ENDEC");

		this.lista.put("RSV_BEGINPROG", "beginprog");
		this.lista2.put("beginprog", "RSV_BEGINPROG");

		this.lista.put("RSV_ENDPROG", "endprog");
		this.lista2.put("endprog", "RSV_ENDPROG");

		this.lista.put("RSV_PRINT", "print");
		this.lista2.put("print", "RSV_PRINT");

		this.lista.put("RSV_IF", "if");
		this.lista2.put("if", "RSV_IF");

		this.lista.put("RSV_ELSE", "else");
		this.lista2.put("else", "RSV_ELSE");

		this.lista.put("RSV_ENDIF", "endif");
		this.lista2.put("endif", "RSV_ENDIF");

		this.lista.put("RSV_WHILE", "while");
		this.lista2.put("while", "RSV_WHILE");

		this.lista.put("RSV_ENDWHILE", "endwhile");
		this.lista2.put("endwhile", "RSV_ENDWHILE");

		this.lista.put("RSV_BETWEEN", "between");
		this.lista2.put("between", "RSV_BETWEEN");

		this.lista.put("RSV_REPEAT", "repeat");
		this.lista2.put("repeat", "RSV_REPEAT");

		this.lista.put("RSV_FUNCTION", "function");
		this.lista2.put("function", "RSV_FUNCTION");

		this.lista.put("RSV_RETURN", "return");
		this.lista2.put("return", "RSV_RETURN");

	}

	public static PalabrasReservadas getInstance() {
		if (instance == null) {
			instance = new PalabrasReservadas();
		}
		return instance;
	}

	public boolean contains(String str) {
		return this.lista.contains(str);
	}

	public String getMnemonic(String str) {
		return (String) lista2.get(str);
	}
}
